package com.elm.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserAuthorityMapper {
    // 插入用户-权限关联记录
    @Insert("INSERT INTO user_authority (user_id, authority_name) " +
            "VALUES (#{userId}, #{name})")
    int addUserAuthority(Integer userId, String name);
    
    @Select("select authority_name from user_authority where user_id=#{userId}")
    String getAuthorityById(int userId);
    
    @Update("Update user_authority set authority_name= #{name} where user_id=#{targetUserId}")
    int updateAuthority(int targetUserId,String name);
}